package wlt.model.rbac;

import org.casbin.jcasbin.main.Enforcer;
import wlt.domain.Request;
import wlt.util.EnforcerUtil;

/**
 * @author wuliting
 * @date 2021/11/5
 * 使用jcasbin实现基于角色的访问控制
**/
public class SimpleRBAC {
    public static void main(String[] args) {
        Enforcer enforcer = EnforcerUtil.createEnforcer("/rbac/model.conf", "/rbac/policy.csv");
        /*
        * test a simple case
        * */
        System.out.println(new Request("alice","data1","write2").isAllowed(enforcer));
    }
}
